﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DotNet.Business;
using DotNet.Model;
using DotNet.Common;
public partial class Admin_adminRecruitment : System.Web.UI.Page
{
    jobBll jBll = new jobBll();
    int pagesize = 20;
    public int num = 0;
    public string input = "<input id='HiddenUrl' type='hidden' value='&CurrentIndex=1' />";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["action"]!=null)
            {
                string action = Request.QueryString["action"].Trim();
                switch (action)
                {
                    case "del":
                        del();
                        break;
                    default:
                        break;
                }
            }
            bindRec();
        }
    }
    #region 删除招聘
    public void del() 
    {
        int jId = Convert.ToInt32(Request.QueryString["jobId"]);
        if (jBll.Delete(jId))
        {

        }       
    }
    #endregion

    #region 绑定招聘
    public void bindRec() 
    {
        if (Request.QueryString["CurrentIndex"]!=null)
        {
            _currentIndex = Convert.ToInt32(Request.QueryString["CurrentIndex"]);
        }
        DataTable dt = jBll.pageingForJob(_currentIndex, pagesize);
        if (dt.Rows.Count==0&&_currentIndex>1)
        {
            --_currentIndex;
            dt = jBll.pageingForJob(_currentIndex, pagesize);
        }
        input = "<input id='HiddenUrl' type='hidden' value='&CurrentIndex=" + _currentIndex+"' />";
        this.Repeater1.DataSource = dt;
        this.Repeater1.DataBind();
    }
    #endregion

    #region 状态维护属性
    private int _currentIndex = 1; 
    #endregion

    #region 分页按钮---郑同飞
    /// <summary>
    /// 分页按钮---郑同飞
    /// </summary>
    public void htmlPaging()
    {
        string str = null;
        int count = 0;
        count = jBll.getRecordCount();
        int pcount = count % pagesize == 0 ? count / pagesize : count / pagesize + 1;
        str = "页次：" + _currentIndex + "/" + pcount + "  每页" + pagesize + " 总收录数据" + count + "条";
        str += HtmlControls.pagIng(_currentIndex, pcount, "adminRecruitment.aspx?CurrentIndex", "pageaa", "pagecurrent");
        Response.Write(str);
    }
    #endregion
}
